package com.lyc.day1107.demo01;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;

/**
 * @author ：Xiaochen
 * @date ：Created in 2022/11/7 18:49
 * @description：
 * @modified By：
 * @version:
 */
public class Test {
    public static void main(String[] args) {
        LocalDateTime dateTime = LocalDateTime.of(2001, 11, 9, 3, 55, 55);
        LocalDateTime now = LocalDateTime.now();
        System.out.println("指定的日期时间"+dateTime.toString());
        System.out.println("当前的日期时间"+now);

    }
    private static void getTime(){
        LocalTime time = LocalTime.of(11, 11, 11);
        LocalTime now = LocalTime.now();
        System.out.println("指定时间"+time);
        System.out.println("当前时间"+now);

        System.out.println("获取时间的小时"+now.getHour());
        System.out.println("获取时间的分钟"+now.getMinute());
        System.out.println("获取时间的份"+now.getSecond());
        System.out.println("获取时间的纳秒"+now.getNano());
    }

    private static void getDate(){
        LocalDate date = LocalDate.of(2022, 10, 7);
        LocalDate now = LocalDate.now();
        System.out.println("指定时间"+date);
        System.out.println("当前日期"+now);

        System.out.println("获取日期的年份"+now.getYear());
        System.out.println("获取日期的年份"+now.getMonth().getValue());
        System.out.println("获取日期的年份"+now.getDayOfWeek().getValue());
    }
}